home *** CD-ROM | disk | FTP | other *** search
/ Multimedia Dogs / Multimedia Dogs v2.0.iso / pc / demos / petdisc / mmpets1d.exe / MMPETS1D.DXR / 00209_Gallery handlers.ls < prev    next >
Encoding:
Text File  |  1995-10-06  |  5.0 KB  |  174 lines

  1. global gCDvolume, gCPU, gBreedDatabase, gBreedDatabaseCount, gGalleryDatabase, gGalleryDatabaseCount, gpGalleryIndex, gpGalleryBigSprite, gpGalleryBigLabelSprite, gpGalleryLabelZoneSprite, gpGalleryBigCastnum, gpGallerySmallCastnum, gpGalleryTextCastnum, gpGalleryBigTextCastnum, gpGalleryBigIsLoaded, gpGallerySlideshowIsRunning, gpGalleryPath, gpGalleryBreedPath, gpGalleryMarker
  2.  
  3. on initGallery
  4.   set gpGalleryBigSprite to 46
  5.   set gpGalleryLabelZoneSprite to 47
  6.   set gpGalleryBigLabelSprite to 48
  7.   set gpGalleryBigCastnum to the number of cast "GalleryHolder.big"
  8.   set gpGallerySmallCastnum to the number of cast "GalleryHolder.sml"
  9.   set gpGalleryTextCastnum to the number of cast "GalleryText.sml"
  10.   set gpGalleryBigTextCastnum to the number of cast "GalleryText.big"
  11.   set gpGalleryBigIsLoaded to 0
  12.   set gpGallerySlideshowIsRunning to 0
  13.   if gCPU = #mac then
  14.     set gpGalleryPath to gCDvolume & ":data:fun:gallery:"
  15.     set gpGalleryBreedPath to gCDvolume & ":data:breeds:"
  16.   else
  17.     set gpGalleryPath to gCDvolume & "\data\fun\gallery\"
  18.     set gpGalleryBreedPath to gCDvolume & "\data\breeds\"
  19.   end if
  20.   set gpGalleryMarker to "gallery"
  21.   set gpGalleryIndex to 1
  22.   installGallerySmallPhoto(gpGalleryIndex)
  23. end
  24.  
  25. on enterGallery
  26.   showAllSprites()
  27.   hideSprite(gpGalleryBigSprite)
  28.   hideSprite(gpGalleryBigLabelSprite)
  29.   hideSprite(gpGalleryLabelZoneSprite)
  30.   setFunMarker(getGalleryMarker())
  31.   setHelpContext("fun")
  32. end
  33.  
  34. on exitGallery
  35.   showAllSprites()
  36. end
  37.  
  38. on getGalleryMarker
  39.   return gpGalleryMarker
  40. end
  41.  
  42. on handleGalleryClickonBIG
  43.   if gpGallerySlideshowIsRunning = 1 then
  44.     stopGallerySlideshow()
  45.   else
  46.     hideGalleryBig()
  47.   end if
  48. end
  49.  
  50. on showGalleryBig
  51.   closeSelectionMIAW()
  52.   if gpGalleryBigIsLoaded = 0 then
  53.     set gpGalleryBigIsLoaded to 1
  54.     installGalleryBigPhoto(gpGalleryIndex)
  55.   end if
  56.   showSprite(gpGalleryBigSprite)
  57.   showSprite(gpGalleryBigLabelSprite)
  58.   showSprite(gpGalleryLabelZoneSprite)
  59. end
  60.  
  61. on hideGalleryBig
  62.   hideSprite(gpGalleryBigSprite)
  63.   hideSprite(gpGalleryBigLabelSprite)
  64.   hideSprite(gpGalleryLabelZoneSprite)
  65.   pointerCursor()
  66. end
  67.  
  68. on startGallerySlideshow
  69.   closeSelectionMIAW()
  70.   disableRandomSounds()
  71.   showGalleryBig()
  72.   updateStage()
  73.   movieCursor()
  74.   set the timeoutLength to 120
  75.   set the timeoutScript to "rollSlideShow"
  76.   set gpGallerySlideshowIsRunning to 1
  77. end
  78.  
  79. on rollSlideShow
  80.   if gpGalleryIndex >= gGalleryDatabaseCount then
  81.     set gpGalleryIndex to 1
  82.   else
  83.     set gpGalleryIndex to gpGalleryIndex + 1
  84.   end if
  85.   waitCursor()
  86.   installGalleryBigPhoto(gpGalleryIndex)
  87.   updateStage()
  88.   movieCursor()
  89. end
  90.  
  91. on stopGallerySlideshow
  92.   waitCursor()
  93.   set gpGallerySlideshowIsRunning to 0
  94.   installGallerySmallPhoto(gpGalleryIndex)
  95.   set gpGalleryBigIsLoaded to 1
  96.   hideGalleryBig()
  97.   enableRandomSounds()
  98.   pointerCursor()
  99. end
  100.  
  101. on nextGallery
  102.   if gpGalleryIndex >= gGalleryDatabaseCount then
  103.     set gpGalleryIndex to 1
  104.   else
  105.     set gpGalleryIndex to gpGalleryIndex + 1
  106.   end if
  107.   installGallerySmallPhoto(gpGalleryIndex)
  108. end
  109.  
  110. on prevGallery
  111.   if gpGalleryIndex = 1 then
  112.     set gpGalleryIndex to gGalleryDatabaseCount
  113.   else
  114.     set gpGalleryIndex to gpGalleryIndex - 1
  115.   end if
  116.   installGallerySmallPhoto(gpGalleryIndex)
  117. end
  118.  
  119. on installGallerySmallPhoto theIndex
  120.   set theRecord to getAt(gGalleryDatabase, theIndex)
  121.   set theName to getAt(theRecord, 1)
  122.   set theCode to getAt(theRecord, 2)
  123.   set theGroup to getAt(theRecord, 3)
  124.   set theDelim to getPathDelim()
  125.   set gpGalleryBigIsLoaded to 0
  126.   if theGroup = "gallery" then
  127.     set theFile to gpGalleryPath & theCode & "3.pic"
  128.   else
  129.     set theFile to gpGalleryBreedPath & theGroup & theDelim & theCode & theDelim & theCode & "3.pic"
  130.   end if
  131.   relink(gpGallerySmallCastnum, theFile)
  132.   set the text of cast gpGalleryTextCastnum to theName
  133.   set gpGalleryIndex to theIndex
  134. end
  135.  
  136. on installGalleryBigPhoto theIndex
  137.   set theRecord to getAt(gGalleryDatabase, theIndex)
  138.   set theName to getAt(theRecord, 1)
  139.   set theCode to getAt(theRecord, 2)
  140.   set theGroup to getAt(theRecord, 3)
  141.   set theDelim to getPathDelim()
  142.   if theGroup = "gallery" then
  143.     set theFile to gpGalleryPath & theCode & "4.pic"
  144.   else
  145.     set theFile to gpGalleryBreedPath & theGroup & theDelim & theCode & theDelim & theCode & "4.pic"
  146.   end if
  147.   relink(gpGalleryBigCastnum, theFile)
  148.   set the text of cast gpGalleryBigTextCastnum to theName
  149. end
  150.  
  151. on handleGalleryPrint
  152.   set theMsg to "Would you like to print the current photo?"
  153.   set theAnswer to confirm(theMsg)
  154.   if theAnswer = 0 then
  155.     exit
  156.   end if
  157.   waitCursor()
  158.   puppetSound("printing.aif")
  159.   updateStage()
  160.   installGalleryBigPhoto(gpGalleryIndex)
  161.   printPICT(the picture of cast gpGalleryBigCastnum, the text of cast gpGalleryTextCastnum)
  162.   pointerCursor()
  163. end
  164.  
  165. on handleGallerySelectAPhoto
  166.   set theString to EMPTY
  167.   repeat with i = 1 to gGalleryDatabaseCount - 1
  168.     set theString to theString & getAt(getAt(gGalleryDatabase, i), 1) & RETURN
  169.   end repeat
  170.   set theString to theString & getAt(getAt(gGalleryDatabase, gGalleryDatabaseCount), 1)
  171.   set theCallback to "tell the stage to installGallerySmallPhoto(theIndex)"
  172.   openSelectionMIAW(theString, "Select A Photo", theCallback)
  173. end
  174.